Get an object by primary key

To get an Employee object that has the ID 9, you can use the Get method:


Employee employee = Employee.Get(9);


If the Employee does not exist, a DataException is thrown.


The second way is to use the TryGet method:


Employee employee;

bool found = Employee.TryGet(9, out employee);


In this case found is False if the Employee does not exist.